package com.sbtr.business.feature.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.sbtr.business.feature.entity.FeStandardRule;
import com.sbtr.business.feature.dto.FeStandardRuleDto;

import com.sbtr.business.feature.service.FeStandardRuleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sbtr.business.feature.mapper.FeStandardRuleMapper;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sbtr.common.PageDto;
import com.sbtr.util.PageDtoUtils;
import org.springframework.transaction.annotation.Transactional;

/**
 * 数据标准化字段列表 Service接口实现类
 *
 * @author dgl
 * @since  2023-04-21
 */
@Transactional
@Service
public class FeStandardRuleServiceImpl extends ServiceImpl<FeStandardRuleMapper,FeStandardRule> implements FeStandardRuleService {

    @Autowired
    FeStandardRuleMapper feStandardRuleMapper;

    @Override
    public PageDto<FeStandardRule> pageList(FeStandardRuleDto feStandardRuleDto) {

        IPage<FeStandardRule> page = new Page<>();
        page.setSize(feStandardRuleDto.getPageSize());
        page.setCurrent(feStandardRuleDto.getPage());
        page = feStandardRuleMapper.selectPages(page, BeanUtil.beanToMap(feStandardRuleDto));
        PageDto<FeStandardRule> r = PageDtoUtils.getPageDtoByIPage(page, FeStandardRule.class);

        return r;
    }
}

